package com.llkj.common.base.app;

import android.support.multidex.MultiDexApplication;

import com.blankj.utilcode.util.ToastUtils;
import com.blankj.utilcode.util.Utils;
import com.llkj.common.di.component.AppComponent;
import com.llkj.common.di.component.DaggerAppComponent;
import com.llkj.common.di.module.AppModule;

import javax.inject.Inject;

/**
 * author: zhu.px
 * e-mail: 1271901673@qq.com
 * time  : 2018/4/18
 * desc  :
 */
public class BaseApp extends MultiDexApplication {

    private static BaseApp instance;
    @Inject
    ActivityLifecycle activityLifecycle;
    private AppComponent mAppComponent;

    public static BaseApp getInstance() {
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        mAppComponent = DaggerAppComponent
                .builder()
                .appModule(new AppModule(instance))
                .build();
        mAppComponent.inject(this);
        Utils.init(instance);
        ToastUtils.setMsgTextSize(13);
        registerActivityLifecycleCallbacks(activityLifecycle);
    }

    public AppComponent getAppComponent() {
        return mAppComponent;
    }
}
